package cs575.wido.action;

import cs575.client.Session;
import cs575.client.WiDo_Service;
import cs575.wido.UserSession;
import cs575.wido.WebServiceFactory;
import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.JFrame;

public class LogoutAction extends AbstractAction {
	protected JFrame parent;
	
	public LogoutAction(final JFrame parent) {
		this.parent = parent;
		putValue(NAME, "Log Out");
	}
	
	@Override
	public void actionPerformed(ActionEvent arg0) {
		// TODO: log out in service
		cs575.client.WiDo wido = WebServiceFactory.getPort();
		Session session = UserSession.getInstance().getSession();
		wido.logout(session);
		parent.dispose();
	}

}
